﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="hrExamineEmpSorce.aspx.cs" Inherits="ZX.WebApp.EHR.hrExamineEmpSorce" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>查看考核项目得分</title>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script src="../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.json-2.2.min.js" type="text/javascript"></script>
    <script src="../Scripts/Jquery.form.js" type="text/javascript"></script>
     <script type="text/javascript" src="../Scripts/CombinButton.js"></script>
        <script type="text/javascript">
    // <![CDATA[
            var fun = "", solutionID = "", planID = "", employeeID;
            $(document).ready(function () {
                solutionID = getPar1("solutionID");
                planID = getPar1("planID");
                employeeID = getPar1("employeeID");
                GetObject();
                GetPlan();
                GetSolutionStandard();
                GetSolutionItem();
                GetObjectID();
            });

            //加载被考核人信息
            function GetObject() {
                var url = "../Extend/AjaxData/jsonlist.aspx?entity=V_hrEmployee&condition=ID='" + employeeID + "'";
                $.get(url, function (d, s) {
                    var list = eval("(" + d + ")");
                    var i = 0;
                    if (list.rows.length > 0) {
                        for (var o in list.rows) {
                            //debugger;
                            var t = list.rows[o].ID;
                            if (typeof (t) != "undefined") {
                                $("#ObjectEmpName").val(list.rows[o].CName);
                                $("#ObjectEmployeeCode").val(list.rows[o].EmployeeCode);
                                $("#ObjectPostName").val(list.rows[o].PostName);
                            }
                        }
                    }
                    else {
                        alert("被考核人信息!");
                        parent.closeWin();
                        return;
                    }
                });
            }

            //取得考核任务ID
            function GetObjectID() {
                var url = "../Extend/AjaxData/jsonlist.aspx?entity=ExaminationObject&condition=EmployeeID='" + employeeID + "' and PlanID='" + planID + "'";
                $.get(url, function (d, s) {
                    var list = eval("(" + d + ")");
                    var i = 0;
                    if (list.rows.length > 0) {
                        for (var o in list.rows) {
                            //debugger;
                            var t = list.rows[o].ID;
                            if (typeof (t) != "undefined") {
                                $("#ObjectID").val(t);
                                IsAppraiseFinish($("#ObjectID").val());
                            }
                        }
                    }
                    else {
                        alert("被考核人信息!");
                        parent.closeWin();
                        return;
                    }
                });
            }

            //判断一个考核计划是否考核完毕
            function IsAppraiseFinish(objectID) {
                YAHOO.util.Connect.asyncRequest('POST', "hrExaminationAjax.aspx?flag=isappraisefinish&objectID=" + objectID, {
                    success: function (res) {
                        try {
                            var str = res.responseText;
                            if (str == "Y") {
                                str = "是"
                            }
                            else {
                                str = "否"
                            }
                            var link = "<a href=\"#\" onclick=\"javascript:fnExaminationRole('" + objectID + "');\" title=\"查看考核角色明细\">" + str + "</a>";
                            $("#SpanIsAppraiseFinish").html(link);
                        }
                        catch (e) {
                        }
                        finally {
                        }
                    },
                    failure: function (error) {
                        alert("数据错误：" + error.statusText);
                    }
                }, null);
            }

            //打开考核角色（任务）明细
            var fnExaminationRole = function (objectID) {
                var pagetitle = $("#ObjectEmpName").val() + "的" + $("#SpanPlan").val() + "考核角色明细";
                parent._employeeTitle = pagetitle;
                var url = "../Extend/YUIDataTableList.aspx?r=" + Math.random() + "&entity=V_ExaminationRole&condition=ObjectID='" + objectID + "'&order=RoleEmpName asc";
                parent.addTabs(pagetitle, encodeURI(url));
                parent.NeedRefreshPage = this;
            }



            //加载考核计划
            function GetPlan() {
                var url = "../Extend/AjaxData/jsonlist.aspx?entity=V_ExaminationPlan&condition=ID='" + planID + "'";
                $.get(url, function (d, s) {
                    var list = eval("(" + d + ")");
                    var i = 0;
                    if (list.rows.length > 0) {
                        for (var o in list.rows) {
                            //debugger;
                            var t = list.rows[o].ID;
                            if (typeof (t) != "undefined") {
                                $("#SpanPlan").val(list.rows[o].Caption);
                                $("#SpanBeginDate").val(list.rows[o].BeginDate);
                                $("#SpanEndDate").val(list.rows[o].EndDate);
                                $("#SolutionName").val(list.rows[o].SolutionName);
                                $("#SolutionRemark").val(list.rows[o].SolutionRemark);
                            }
                        }
                    }
                    else {
                        alert("考核计划为空!");
                        parent.closeWin();
                        return;
                    }
                });
            }

            //加载考核方案标准
            function GetSolutionStandard() {
                var url = "../Extend/AjaxData/jsonlist.aspx?entity=V_ExaminationStandard&condition=SolutionID='" + solutionID + "'&order=CateoryName asc";
                $.get(url, function (d, s) {
                    var list = eval("(" + d + ")");
                    var i = 0;
                    if (list.rows.length > 0) {
                        for (var o in list.rows) {
                            //debugger;
                            var t = list.rows[o].ID;
                            if (typeof (t) != "undefined") {
                                addtr("tbStandard");
                                //获取最后一行对像，即刚新增的行对像
                                var lastTr = $("#tbStandard tr").last();
                                $("#Cateory", lastTr).val(list.rows[o].CateoryName);
                                $("#StandardSocre", lastTr).val(list.rows[o].Socre);
                                $("#FinishRate", lastTr).val(list.rows[o].FinishRate);
                            }
                        }
                    }
                    else {
                        //
                    }
                });
            }

            //加载考核项目
            function GetSolutionItem() {
                //debugger;
                var totalConvertSorce=0.0;
                var url = "../Extend/AjaxData/jsonlist.aspx?entity=V_ExaminationResultItemTotal&condition=SolutionID='" + solutionID + "' and PlanID='" + planID + "' and EmployeeID='" + employeeID + "'&order=ItemSeq asc";
                $.get(url, function (d, s) {
                    var list = eval("(" + d + ")");
                    var i = 0;
                    if (list.rows.length > 0) {
                        for (var o in list.rows) {
                            //debugger;
                            var t = list.rows[o].ID;
                            if (typeof (t) != "undefined") {
                                addtr("tbItem");
                                //获取最后一行对像，即刚新增的行对像
                                var lastTr = $("#tbItem tr").last();
                                $("#Seq", lastTr).val(list.rows[o].ItemSeq);
                                $("#ItemCateoryName", lastTr).val(list.rows[o].ItemCateoryName);
                                $("#ItemName", lastTr).val(list.rows[o].Itemname);
                                $("#ItemRemark", lastTr).val(list.rows[o].ItemRemark);
                                var socreLink = "<a href=\"#\" onclick=\"javascript:fnExaminationResult('" + list.rows[o].ItemID + "');\" title=\"查看考核结果明细\">" + list.rows[o].ConvertSorce + "</a>";
                                $("#Socre", lastTr).html(socreLink);
                                totalConvertSorce = totalConvertSorce + parseFloat(list.rows[o].ConvertSorce);
                            }
                        }
                        $("#tbItem").append("<tr><td colspan='4' align='left'>合计:</td><td>" + totalConvertSorce.toFixed(2) + "</td></tr>");
                    }
                    else {
                        //
                    }
                });
            }

            //打开考核结果明细链接
            var fnExaminationResult = function (itemID) {
                var pagetitle = "查看考核结果明细";
                parent._employeeTitle = pagetitle;
                var url = "../Extend/YUIDataTableList.aspx?r=" + Math.random() + "&entity=V_ExaminationResult&condition=SolutionID='" + solutionID + "' and PlanID='" + planID + "' and EmployeeID='" + employeeID + "' and ItemID='" + itemID + "'&order=ConvertSorce asc";
                parent.addTabs(pagetitle, encodeURI(url));
                parent.NeedRefreshPage = this;
            }


            //增加行
            function addtr(tbName) {
                var tr = $("#" + tbName + " tr").eq(1).clone();
                tr.show();
                tr.appendTo("#" + tbName);
            }

            //删除行
            function deltr(tbName) {
                //遍历tr
                $("#" + tbName + " tr").first().nextAll().each(function () {
                    if ($(this).hasClass("selectedTr")) {
                        $(this).remove();
                    }
                });
            };
    // ]]> 
     </script>
    <style type="text/css">
        body{font-family: 宋体, Arial, Helvetica, sans-serif;font-size: 12px;color: #333333;background-color: #FFFFFF;} 
        select{width:99%;} 
        td { border: 1px solid #CCCCCC;}
        .textarea{ width: 96%;height: 25px;}	
        .selectedTr{  background-color: blue;} 
        A:link {text-decoration:none;color:blue}
        A:visited {text-decoration:none;color:#80006f}
        A:hover {text-decoration:underline;color:red} 
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div id="divBody">
        <table align="center" class="TableBlock" width="99%" id="tbObject" name="tbObject">
            <tr>
	            <td align="left" class="TableData" width="200">【被考核人：】
		            <input  id="ObjectEmpName" name="ObjectEmpName"  type="text"  readonly="readonly"  style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent;" />
                </td>
                <td align="left" class="TableData" width="200">
	           【编号：】
		        <input  id="ObjectEmployeeCode" name="ObjectEmployeeCode"  type="text"  readonly="readonly"  style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent;" />
                </td>
               <td align="left" class="TableData" width="200">
                【岗位：】
		        <input  id="ObjectPostName" name="ObjectPostName"  type="text"  readonly="readonly"  style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent;" />
                </td>
            </tr>
        </table>    
        <table align="center" class="TableBlock" width="99%" id="Table1" name="tbSolution">
            <tr>
	            <td align="left" class="TableData" width="120" >【考核计划：】
		            <input  id="SpanPlan" name="SpanPlan"  type="text"  readonly="readonly"  style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent;width:200px;" />
                </td>
	            <td align="left" class="TableData" width="150">【开始时间：】
		            <input  id="SpanBeginDate" name="SpanBeginDate"  type="text"  readonly="readonly"  style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent;" />
                </td>
                <td align="left" class="TableData" width="150">
	            【结束时间：】
		        <input  id="SpanEndDate" name="SpanEndDate"  type="text"  readonly="readonly"  style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent;" />
               </td>
	            <td align="left" class="TableData" width="120">【考核完毕：】
                    <span id="SpanIsAppraiseFinish"></span>
                    <input id="ObjectID" name="ObjectID" type="hidden" />
                </td>
            </tr>
        </table>
        <table align="center" class="TableBlock" width="99%" id="tbSolution" name="tbSolution">
            <tr>
	            <td align="left" class="TableData" width="150">【考核方案：】
		            <input  id="SolutionName" name="SolutionName"  type="text"  readonly="readonly"  style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent;width:200px;" />
                </td>
                <td align="left" class="TableData" width="230">
	            【方案说明：】
		        <input  id="SolutionRemark" name="SolutionRemark"  type="text"  readonly="readonly"  style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent;width:500px;" />
               </td>
            </tr>
        </table><br />
        <div id="divStandard">
        <span>【考核标准】</span>
        <table align="center" border="1" id="tbStandard" name="tbStandard" style="border-collapse: collapse" width="99%">
            <tr style="background-color: #e4e7e2">
	            <td align="center">分类</td>
	            <td align="center">得分</td>
	            <td align="center">完成程度(%)</td>
            </tr>
            <tr style="display:none">
	            <td>
                    <input  id="Cateory" name="Cateory"  type="text" readonly="readonly" style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent" />
                </td>
	            <td>
		            <input  id="StandardSocre" name="StandardSocre"  type="text" readonly="readonly" style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent" />
                </td>
	            <td>
		            <input  id="FinishRate" name="FinishRate"  type="text" readonly="readonly"  style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent" />
                </td>
            </tr>
        </table>
        </div><br />
        <div id="divItem">
        <span>【考核项目】</span>
        <table align="center" border="1" id="tbItem" name="tbItem" style="border-collapse: collapse" width="99%">
            <tr style="background-color: #e4e7e2">
	            <td align="center" width="50px">序号</td>
	            <td align="center" width="120">分类</td>
	            <td align="center" width="120">项目名称</td>
	            <td align="center" >项目说明</td>
	            <td align="center" width="80">得分</td>
            </tr>
            <tr style="display:none">
	            <td>
                    <input  id="Seq" name="Seq"  type="text" readonly="readonly" style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent;width:50px;" />
                </td>
	            <td>
		            <input  id="ItemCateoryName" name="ItemCateoryName"  type="text"  readonly="readonly" style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent" />
                </td>
	            <td>
		            <input  id="ItemName" name="ItemName"  type="text" readonly="readonly"  style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent" />
                </td>
	            <td>
		            <input  id="ItemRemark" name="ItemRemark"  type="text"  readonly="readonly"  style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent;width:700px;" />
                </td>
	            <td>
                    <%--	<input  id="Socre" name="Socre"  type="text"  readonly="readonly" style="border-bottom-style: none; border-bottom-color: transparent; border-right-style: none; border-top-color: transparent; border-top-style: none; border-right-color: transparent; border-left-style: none; border-left-color: transparent" />--%>                    
                    <span id="Socre"></span>
                </td>
            </tr>
        </table>
        </div>
    </div>
    </form>
</body>
</html>
